package com.yss.sofa.report.engine.cell.visible;

import com.yss.sofa.report.engine.Const;
import com.yss.sofa.report.engine.cell.ReportCell;

public class VisibleCell extends ReportCell{
	private static final long serialVersionUID = -4282973951781057847L;
	//主要用于确认来源，以及获取style，但动态style不能从rcfrom中获取
	protected int rfrom;
	protected int cfrom;
	//动态可见后，top!=rfrom；
	//在resultcell中，top!=rbegin，因为在矩阵中会坐标转换
	protected int top;
	//动态可见后，left!=cfrom；
	//在resultcell中，left!=cbegin，因为在矩阵中会坐标转换
	protected int left;
	protected int move;
	protected int lazy;
	protected int dataType;
	protected int rbegin;
	protected int rend;
	protected int cbegin;
	protected int cend;
	
	protected void init(){
		super.init();
		this.move=Const.CELL_MOVE_INFER;//推断
		this.dataType=Const.CELL_DATA_TYPE_STRING;
		this.lazy=0;
	}
	public void assignTo(ReportCell cell){
		VisibleCell _=(VisibleCell)cell;
		super.assignTo(_);
		_.rfrom=this.rfrom;
		_.cfrom=this.cfrom;
		_.top=this.top;
		_.left=this.left;
		_.move=this.move;
		_.dataType=this.dataType;
		_.rbegin=this.rbegin;
		_.rend=this.rend;
		_.cbegin=this.cbegin;
		_.cend=this.cend;
	}
	public VisibleCell create(){
		VisibleCell _=new VisibleCell();
		this.assignTo(_);
		return _;
	}
	
	public int getLazy() {
		return (lazy>=0)?lazy:0;
	}
	public void setLazy(int lazy) {
		this.lazy = lazy;
	}
	public int getMove() {
		return move;
	}
	public void setMove(int move) {
		this.move = move;
	}
	public boolean isMerge(){
		return (rbegin!=rend) || (cbegin!=cend);
	}
	public boolean isRowMerge(){
		return (rbegin!=rend);
	}
	public boolean isColMerge(){
		return (cbegin!=cend);
	}
	public int getDataType() {
		return dataType;
	}
	public void setDataType(int dataType) {
		this.dataType = dataType;
	}
	public int getColInc(){
		return cend-cbegin+1;
	}
	public int getRowInc(){
		return rend-rbegin+1;
	}
	public int getRfrom() {
		return rfrom;
	}
	public void setRfrom(int rfrom) {
		this.rfrom = rfrom;
	}
	public int getCfrom() {
		return cfrom;
	}
	public void setCfrom(int cfrom) {
		this.cfrom = cfrom;
	}
	public int getRbegin() {
		return rbegin;
	}
	public void setRbegin(int rbegin) {
		this.rbegin = rbegin;
	}
	public int getRend() {
		return rend;
	}
	public void setRend(int rend) {
		this.rend = rend;
	}
	public int getCbegin() {
		return cbegin;
	}
	public void setCbegin(int cbegin) {
		this.cbegin = cbegin;
	}
	public int getCend() {
		return cend;
	}
	public void setCend(int cend) {
		this.cend = cend;
	}
	public int getTop() {
		return top;
	}
	public void setTop(int top) {
		this.top = top;
	}
	public int getLeft() {
		return left;
	}
	public void setLeft(int left) {
		this.left = left;
	}
	public int getStyleRfrom(){
		return rfrom;
	}
	public int getStyleCfrom(){
		return cfrom;
	}
}
